package com.bawei.module_home.discovery.adapter

import android.widget.ImageView
import android.widget.TextView
import com.bawei.library_common.utils.ImageUtils
import com.bawei.module_home.R
import com.bawei.module_home.discovery.entity.DiscoveryEntity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @Author : yaotianxue
 * @Time : On 2023/5/29 19:58
 * @Description : CategoryItemAdapter 单布局：分类
 */
class CategoryItemAdapter(val layoutId:Int,val list:MutableList<DiscoveryEntity.ItemX>): BaseQuickAdapter<DiscoveryEntity.ItemX, BaseViewHolder>(layoutId,list) {
    override fun convert(holder: BaseViewHolder, item: DiscoveryEntity.ItemX) {
        var imageView = holder.getView<ImageView>(R.id.iv_category_bg)
        var textView = holder.getView<TextView>(R.id.tv_label)
        ImageUtils.loadImageView(context,item.data.image,imageView)
        textView.text = item.data.title.toString()
    }
}